<?php
include_once 'plugin/ExpressLocation.php';

class ajaxController extends manageController {
   public function orderLocationAction(){
//       $SLW = new SLWExpressClass($debug,$data['user365Id'],$data['365pwd'],$data['365serviceKey']);
       $shop_express_no = (!empty($this->params['shop_express_no'])) ? $this->params['shop_express_no'] : '';
       $shop_no = (!empty($this->params['shop_no'])) ? $this->params['shop_no'] : '';
       $express_order_no = (!empty($this->params['express_order_no'])) ? $this->params['express_order_no'] : '';
       $express_type= (!empty($this->params['express_type'])) ? $this->params['express_type'] : '';
//       if(empty($shop_express_no) || empty($shop_no)){
//           return json_encode(['status'=>400,'msg'=>'参数异常']);
//           exit;
//       }


       $config = Config::getInstance();
       $website_array = $config->getWebSiteConfig();

       $shop_no = 100624;
       $express_order_no = '011191053412375111';

       $whereR = array("AND" => array("=" => array('store_id'=>$shop_no, "isdeleted"=>0)));
       $shop_no_info = $this->model->getItemByOther($whereR,'xd_store');
       $storeData = [];
       $storeData['user365Id'] = $shop_no_info[0]['user365Id'];
       $storeData['365pwd'] = $shop_no_info[0]['365pwd'];
       $storeData['365serviceKey'] = $shop_no_info[0]['365serviceKey'];
       $storeData['shop_no'] = $shop_no;
       $storeData['debug'] = $website_array['debug'];
       $storeData['express_order_no'] = $express_order_no;
       $storeData['express_type'] = 'slw';

//       $row = new SLWTokenClass($storeData,$this->model);
//       $token = $row->token();

//       $SLW = new SLWExpressClass($website_array['debug'],$shop_no_info[0]['user365Id'],$shop_no_info[0]['365pwd'],$shop_no_info[0]['365serviceKey']);
//       $data['token'] = $token;
//       $data['orderId'] = $express_order_no;
//       $r = $SLW->orderLocation($data);



       $location = new GetExpressLocation();

       $r = $location->get_result((array)$storeData,$this->model);
       var_dump($r);die;



//       array(3) {
//           ["data"]=>
//                array(8) {
//                               ["orderLat"]=>
//                string(9) "41.816755"
//                               ["empPhone"]=>
//                string(11) "18642032640"
//                               ["empName"]=>
//                string(6) "杨亮"
//                               ["orderStatus"]=>
//                string(4) "1102"
//                               ["receiverCode"]=>
//                string(4) "5203"
//                               ["orderLon"]=>
//                string(10) "123.443749"
//                               ["senderCode"]=>
//                string(4) "9979"
//                               ["totalCost"]=>
//                string(1) "7"
//                }
//                ["message"]=>
//                string(24) "订单信息获取成功"
//           ["errorcode"]=>
//                int(0)
//}
       return json_encode();
   }
}
